/* MyClient.java
 * 
 * Author: k4ge
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *  
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Please contact k4ge at karthikjain@gmail.com or
 * visit www.karthikjain.wordpress.com if you need additional
 * information or have any questions.
 */

package myExperiments.multiClientServer;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;

public class MyClient {
	/**
	 * @param args
	 * @throws NumberFormatException
	 * @throws UnknownHostException
	 * @throws IOException
	 */

	public static void main(String[] args) throws NumberFormatException,
			UnknownHostException, IOException {
		Socket cs = new Socket("localhost", 1947);
		Scanner sc = new Scanner(System.in);
		System.out.print("Enter scores of 3 subjects: ");

		DataOutputStream dos = new DataOutputStream(cs.getOutputStream());

		dos.writeFloat(sc.nextFloat());
		dos.writeFloat(sc.nextFloat());
		dos.writeFloat(sc.nextFloat());

		DataInputStream dis = new DataInputStream(cs.getInputStream());
		System.out.println("Result is " + dis.readUTF());

		dis.close();
		dos.close();

		cs.close();
	}
}
